<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    </head>
    <body>
        <script src="tbaidu.js"></script>
        <link type="text/css" rel="stylesheet" id="reset.css" href="http://res.t.baidu.com/css/reset.css?20101104" media="all" /> 
        <link type="text/css" rel="stylesheet" id="style.css" href="http://res.t.baidu.com/css/style.css?20101104" media="all" /> 
        <link type="text/css" rel="stylesheet" id="ui.css" href="http://res.t.baidu.com/css/ui.css?20101104" media="all" /> 

        <style>
            body {
                width:320px;
                overflow-x:hidden;
                padding-top: 10px;
            }
            table.status {
                font-size: 12px;
            }
            td { padding:2px;}
            a{color:blue;text-decoration:none;}
            a:visited{color:blue;}
            a:hover{color:red;text-decoration:underline;}
        </style>

        <div id="loggedin" style="display: none; padding-left:5px; padding-right:5px;">
            <a href="http://t.baidu.com" target="_blank">说吧首页</a><br/>
            <table border="0" class="status" id="status">
                <tr>
                    <td style="text-align:right"> 被关注： </td>
                    <td> <a href="http://t.baidu.com/followers" target="_blank">新增<span id="notice_follow">0</span>人</a> </td>
                </tr>
                <tr>
                    <td style="text-align:right"> 回复： </td>
                    <td> <a href="http://t.baidu.com/reply" target="_blank">新增<span id="notice_reply">0</span>条</a> </td>
                </tr>
                <tr>
                    <td style="text-align:right"> @我： </td>
                    <td> <a href="http://t.baidu.com/mention" target="_blank">新增<span id="notice_forward">0</span>条</a> </td>
                </tr>
                <tr>
                    <td style="text-align:right"> 交换手机： </td>
                    <td> <a href="http://t.baidu.com/contacts" target="_blank">新增<span id="notice_contact">0</span>人</a> </td>
                </tr>
                <tr>
                    <td style="text-align:right"> 私聊： </td>
                    <td> <a href="http://t.baidu.com/inbox" target="_blank">新增<span id="notice_inbox">0</span>条</a> </td>
                </tr>
            </table>
            <div style="text-align: right; margin-top:5px;">
                <textarea id="content" style="width:310px; height:80px; padding:3px;" onkeyup="javascript:updateCount();"></textarea><br/>
                <span id="msgstatus" style="margin-right: 3px; color:red;"></span>
				<span id="wordcount" style="padding-left:2px;padding-right:2px;">140字</span>
                <input type="button" onclick="javascript:ISay();" id="btnSend" value="我说" style="width: 80px; height:25px;"/>
            </div>
        </div>
        <div id="login" style="display: none; margin-left:10px;">
            <a href="http://t.baidu.com/userlogin" target="_blank">请先登录说吧</a>
        </div>

        <script>
		function updateCount()
		{
			G('wordcount').innerHTML = (140 - G('content').value.length) + '字';
			if (G('content').value.length > 140)
			{
				G('wordcount').innerHTML = '<font color="red">'+
										G('wordcount').innerHTML +'</font';
				G('msgstatus').innerHTML = '超过140字，可能无法发出。';
			}
			else
				G('msgstatus').innerHTML = '';
		}
            var st = localStorage;
            if (st.user_id == 0)
            {
                G('login').style.display = 'block';
                chrome.tabs.getAllInWindow(null, tabSearch);
            }
            else
            {
                G('notice_follow').innerHTML    = st.follow_count;
                G('notice_reply').innerHTML     = st.reply_count;
                G('notice_forward').innerHTML   = st.forward_count;
                G('notice_contact').innerHTML   = st.contact_count;
                G('notice_inbox').innerHTML     = st.inbox_count;
                G('loggedin').style.display = 'block';
            }
        </script>
    </body>
</html>
